/**
 * @Author: panda
 * @Date: 2022-05-18 10:42
 * @Description: 激活组件钩子函数 copy
 */
import { nextTick, onMounted, onActivated } from 'vue'


export function onMountedOrActivated (hook: Fn) {
  let mounted: boolean

  onMounted(() => {
    hook()
    nextTick(() => {
      mounted = true
    })
  })

  onActivated(() => {
    if (mounted) {
      hook()
    }
  })
}
